//
//  returnvalue.cpp
//  learnC++
//
//  Created by apple on 2018/5/31.
//  Copyright © 2018年 yunfan.com. All rights reserved.
//

#include "returnvalue.hpp"

//元组可以是不同类型,返回多个值
std::tuple<int,double> returnStruct(){
    
    std::tuple<int,double,std::string> tuple = std::make_tuple(5,6.3,"jack");
    int a;
    double b;
    std::string name;
    std::tie(a,b,name) = tuple;//给a,b,name赋值
    std::tie(std::ignore,b,name) = tuple;
    
    auto value1 = std::get<0>(tuple);
    
    int size = std::tuple_size<decltype(tuple)>::value;
    
    return std::make_tuple(5,6.2);
}

void test_return_value(){
    
    std::tuple<int,double> s = returnStruct();
    auto [a, b] = returnStruct();
    std::cout << std::get<0>(s) << "====" << std::get<1>(s) << std::endl;
    std::cout << a << ' ' << b << '\n';
}
